package com.fivium.bpd.editor.renderer;

import java.awt.Color;
import java.awt.Component;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

import com.fivium.bpd.component.Assignment;
import com.fivium.bpd.component.QueryDefinition;
import com.fivium.bpd.component.QueryDefinition.QUERY_TYPE;

abstract public class AbstractCellRenderer extends JLabel
    implements ListCellRenderer
{
  private static final Color HIGHLIGHT_COLOR = new Color(0, 0, 128);
 
  public AbstractCellRenderer()
  {
    setOpaque(true);
  }

  @Override
  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
      boolean cellHasFocus)
  {
    buildRenderableContent(value);  
    
    if (isSelected) {
      setBackground(HIGHLIGHT_COLOR);
      setForeground(Color.white);
    } else {
      setBackground(Color.white);
      setForeground(Color.black);
    }
    
    return this;
  }
  
  protected void buildRenderableContent(Object value)
  {
    ;
  }
}
